﻿<!doctype html>
<html lang="en">
<head>
    <script type="text/javascript" src="js/jquery-2.1.3.js"></script>
    <script>
        $(function () {
            var url= "/rest/rest/info/all?type=L";
            var t = $.getJSON(url, function (data) {
                var array = data;
                var index = 0;
                for (var i in array) {
                    
                    if (i % 3 == 0) {
                        var newRow = "";
                        newRow += "<tr>";
                    }
                    newRow += "<td>" + i + "</td>";
                    var location = array[i];
                    var link = "<a target='_parent' href='/web/company.html?location=" + location + "'>" + location + "</a>";
                    newRow += "<td>" + link + "</td>";
                    if (i % 3 == 2) {
                        newRow += "</tr>";
                        $("#table1 tr:last").after(newRow);
                    }
                    index++;      
                }

                if (index % 3 != 0) {
                    newRow += "</tr>";
                    $("#table1 tr:last").after(newRow);
                }
            });
        });
    </script>
</head>
<body>
    <div id="input">
        <table id="table1" border="0"><tr><th>id&nbsp;</th><th>location</th><th>id&nbsp;</th><th>location</th><th>id&nbsp;</th><th>location</th></tr></table>
    </div>
    
</body>
</html>